<?php
// +----------------------------------------------------------------------
// | Author: derek <693472824@qq.com> <http://www.bloveambition.com/>
// +----------------------------------------------------------------------

namespace Blovex4\Model;
use Think\Model\ViewModel;

/**
 * 订单模型层
 * derek <693472824@qq.com>
 */
class OrdersViewModel extends ViewModel {

    /**
     * 尽量减少需查询字段，以提高查询效率
     */
    protected $viewFields = array(
            
        'Worker'    =>  array('worker_id', 'account'=>'w_account', 'name', 'eid',
                            '_type'=>'RIGHT'
        ),
        
        'Orders'     =>  array('order_id', 'detail_id', 'emergency', 'appointment', 'site_id',
                            'status', 'create_time', 'service_time', 'pay_type', 'turnover',
                            '_on'=>'Worker.worker_id=Orders.worker_id'         
        ),
            
        'User'    =>  array(
                            'account', 'username',
                            '_on'=>'Orders.user_id=User.user_id'
        ),
            
        'UserAddress'    =>  array(
                            'contact', 'telphone', 'address', 'latitude', 'longitude',
                            '_on'=>'Orders.address_id=UserAddress.address_id'
                
        )
    );
}